import request from '@/utils/request'
import {SysDictDataParams, SysDictDataQuery} from "@/common/interface/dict/data.ts";

// 查询字典数据列表
export function listDictData(query: SysDictDataQuery) {
    return request({
        url: '/system/dict/data/list',
        method: 'get',
        params: query
    })
}

// 根据字典类型查询字典数据列表
export function getDictDatas(dictType: string) {
    return request({
        url: '/system/dict/data/list/' + dictType,
        method: 'get',
    })
}

// 查询字典数据详细
export function getDictData(id: number) {
    return request({
        url: '/system/dict/data/' + id,
        method: 'get'
    })
}

// 新增字典数据
export function addDictData(data: SysDictDataParams) {
    return request({
        url: '/system/dict/data',
        method: 'post',
        data: data
    })
}

// 修改字典数据
export function updateDictData(data: SysDictDataParams) {
    return request({
        url: '/system/dict/data',
        method: 'put',
        data: data
    })
}

// 删除字典数据
export function delDictData(id: number[]) {
    return request({
        url: '/system/data/dict/' + id,
        method: 'delete'
    })
}
